
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------ 界面调试
    local Widget = require "widgets/widget"
    local Image = require "widgets/image" -- 引入image控件
    local UIAnim = require "widgets/uianim"
    local Screen = require "widgets/screen"
    local AnimButton = require "widgets/animbutton"
    local ImageButton = require "widgets/imagebutton"
    local Menu = require "widgets/menu"
    local Text = require "widgets/text"
    local TEMPLATES = require "widgets/redux/templates"
    local ScrollableList = require "widgets/scrollablelist"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local flg,error_code = pcall(function()
    print("WARNING:PCALL START +++++++++++++++++++++++++++++++++++++++++++++++++")
    local x,y,z =    ThePlayer.Transform:GetWorldPosition()  
    ----------------------------------------------------------------------------------------------------------------    ----------------------------------------------------------------------------------------------------------------
    ---
        -- print(ThePlayer.hutao_classified)
        if ThePlayer.components.hutao_com_level_sys then
            -- ThePlayer.components.hutao_com_level_sys:LevelUpBreak()
            -- ThePlayer.components.hutao_com_level_sys:ExpDoDelta(1000)
        end
        -- print("当前经验",ThePlayer.replica.hutao_com_level_sys:GetExp())
        -- print("当前等级",ThePlayer.replica.hutao_com_level_sys:GetLevel())

        -- ThePlayer.components.hutao_com_max_value_controller:Debug()
        -- print(ThePlayer.components.health:GetPercent())
    ----------------------------------------------------------------------------------------------------------------
    ---
        -- ThePlayer.components.talker:Say({Line("AAA",nil,5),Line("BBB",nil,5),Line("CCC",nil,5)})
        -- ThePlayer.components.hutao_com_dialogue:Say("level_up_locking")
        -- local dialogue = {{"古人云：日~就~月~将。",0},{"但我双眼不见日月，所以就该摸鱼！",5}}
        -- local _script = {}
        -- for i,v in ipairs(dialogue) do
        --     if type(v) == "table" and type(v[1]) == "string" and type(v[2]) == "number" then
        --         table.insert(_script,Line(v[1],nil,v[2]))
        --     end
        -- end
        -- ThePlayer.components.talker:Say({
        --     Line("古人云：日~就~月~将。",nil,0),
        --     Line("但我双眼不见日月，所以就该摸鱼！",nil,5),
        -- })
    ----------------------------------------------------------------------------------------------------------------
    ---
    ----------------------------------------------------------------------------------------------------------------
    ---  
        -- ThePlayer.components.hutao_com_sanity_custom_rate:AddRate(ThePlayer,-TUNING.DAPPERNESS_SMALL/8*21)

    ----------------------------------------------------------------------------------------------------------------
    ---
        -- local function test_fn(inst,a,b,c,d,e)
        --     print("test_fn",inst,a,b,c,d,e)
        -- end
        -- ThePlayer:DoPeriodicTask(1,test_fn,2,"A1","B2","C3","D4","E5")
        -- local fx = SpawnPrefab("hutao_sfx_pink_flame")
        -- fx:PushEvent("Set",{
        --     target = ThePlayer,
        -- })
        -- -- fx.AnimState:PlayAnimation("puff_3")
        -- fx:DoTaskInTime(1, fx.Remove)


        -- local fx = SpawnPrefab("halloween_firepuff_"..math.random(3))
        -- fx.Transform:SetPosition(x,y,z)
        -- fx.AnimState:SetBuild("hutao_sfx_pink_flame")


        -- TUNING.test_fn= function(inst)
        --     -- inst.AnimState:SetBuild("hutao_sfx_pink_flame")
        --     inst.AnimState:SetAddColour(255/255,0/255,153/255,1)
        -- end
        -- SpawnPrefab("hutao_sfx_pink_flame_"..math.random(3)).Transform:SetPosition(x,y,z)
    ----------------------------------------------------------------------------------------------------------------
    -- time_of_butterfly_concealment
        -- ThePlayer.components.hutao_com_talent_tree:ForceUnlock("time_of_butterfly_concealment")

        -- if ThePlayer.test_indicator then
        --     ThePlayer.test_indicator:Remove()
        -- end

        -- local color = Vector3(255/255,153/255,50/255)

        -- local indicator = SpawnPrefab("hutao_sfx_dotted_circle_client")
        -- indicator.AnimState:SetAddColour(color.x, color.y, color.z, 0)
        -- indicator.AnimState:SetMultColour(color.x, color.y, color.z, 1)
        -- indicator.AnimState:SetBloomEffectHandle("shaders/anim.ksh")

        -- indicator:PushEvent("Set",{pt = Vector3(0,0,0),radius = 10})
        -- ThePlayer:AddChild(indicator)
        -- ThePlayer.test_indicator = indicator

    ----------------------------------------------------------------------------------------------------------------
    ---
        -- 梅花 - Plum blossom         plum_blossom
        -- 煤花 - Coal flower           coal_flower
        -- 没花 - No flower            no_flower   
        -- 莓花 - Berry flower         berry_flower
        -- c_select().components.hutao_com_flower_switcher:Switch("plum_blossom")
        -- c_select().components.hutao_com_flower_switcher:Switch("coal_flower")
        -- c_select().components.hutao_com_flower_switcher:Switch("no_flower")
        -- c_select().components.hutao_com_flower_switcher:Switch("berry_flower")

        -- local types = {
        --     "plum_blossom",
        --     "coal_flower",
        --     "no_flower",
        --     "berry_flower",
        -- }
        -- local ents = TheSim:FindEntities(x,0, z,10,{"_hutao_com_flower_switcher"} )

        -- local num = 1
        -- local function GetType()
        --     local ret = types[num]
        --     num = num + 1
        --     if num > #types then
        --         num = 1
        --     end
        --     return ret
        -- end
        -- --- 按类型顺序循环
        -- for _,ent in ipairs(ents) do
        --     ent.components.hutao_com_flower_switcher:Switch(GetType())            
        -- end


    ----------------------------------------------------------------------------------------------------------------
    ---

        -- local function create_buff_mask_in_client_side(inst)
        --     -----------------------------------------------------
        --     --- 预检查 和 模块引入
        --         local Widget = require "widgets/widget"
        --         local Image = require "widgets/image"
        --         local Text = require "widgets/text"
        --     -----------------------------------------------------
        --     --- 根节点
        --         local root = ThePlayer.HUD
        --         local root = root:AddChild(Widget())
        --         root:SetHAnchor(0) -- 设置原点x坐标位置，0、1、2分别对应屏幕中、左、右
        --         root:SetVAnchor(0) -- 设置原点y坐标位置，0、1、2分别对应屏幕中、上、下
        --         root:SetPosition(0,0)
        --         -- root:MoveToFront()
        --         root:MoveToBack()
        --         root:SetScaleMode(SCALEMODE_FIXEDSCREEN_NONDYNAMIC)   --- 缩放模式
        --         root:SetClickable(false)
        --     -----------------------------------------------------
        --     ---
        --     -----------------------------------------------------
        --     --- 图层
        --         local img = root:AddChild(Image())
        --         img:SetTexture("images/widgets/hutao_debuff_undying_lich_mask.xml","hutao_debuff_undying_lich_mask.tex")
        --         -- local scale = 2.2
        --         -- img:SetScale(scale,scale,scale)
        --         img:SetFadeAlpha(0.7)
        --     -----------------------------------------------------
        --     --- 文本
        --         local time_str = root:AddChild(Text(CODEFONT,40,"000",{ 255/255 , 0/255 ,0/255 , 1}))
        --         local time_pt = Vector3(-200,320,0)
        --         time_str:SetPosition(time_pt.x,time_pt.y)
        --     -----------------------------------------------------
        --     --- 
        --         root.inst:ListenForEvent("timer_update",function()
        --             local time = inst.__timer:value()
        --             time_str:SetString(tostring(time))
        --         end,inst)
        --     -----------------------------------------------------
        --     --- 移除
        --         root.inst:ListenForEvent("onremove",function()
        --             root:Kill()
        --         end,inst)
        --     -----------------------------------------------------
        --     ---
        --         return root
        --     -----------------------------------------------------
        -- end

        -- local function create_fake_light_in_client_side(parent)
        --     local inst = CreateEntity()
        --     inst.entity:AddTransform()
        --     inst.entity:AddLight()        
        --     inst.Light:SetFalloff(0.1)
        --     inst.Light:SetIntensity(.7)
        --     inst.Light:SetRadius(3)
        --     inst.Light:SetColour(180 / 255, 195 / 255, 150 / 255)
        --     inst.entity:SetParent(parent.entity)
        --     return inst
        -- end

        -- if ThePlayer.test_root then
        --     ThePlayer.test_root:Kill()
        -- end
        -- if ThePlayer.test_light then
        --     ThePlayer.test_light:Remove()
        -- end
        -- ThePlayer.test_root = create_buff_mask_in_client_side(ThePlayer)
        -- ThePlayer.test_light = create_fake_light_in_client_side(ThePlayer)

        -- ThePlayer:AddDebuff("hutao_debuff_undying_lich","hutao_debuff_undying_lich")
        -- print(ThePlayer:HasDebuff("hutao_debuff_undying_lich"))
        -- local debuff = ThePlayer:GetDebuff("hutao_debuff_undying_lich")
        -- print("debuff",debuff)
        -- debuff:Remove()
    ----------------------------------------------------------------------------------------------------------------
    ---
        -- local owner = ThePlayer
        -- owner.AnimState:OverrideSymbol("hair_hat", "hutao_equipment_exquisite_ornament", "hair_hat")
        -- owner.AnimState:OverrideSymbol("headbase_hat", "hutao_equipment_exquisite_ornament", "headbase_hat")

        -- owner.AnimState:Show("HAT")
        -- owner.AnimState:Show("HAIR_HAT")
        -- owner.AnimState:Hide("HEAD")
        -- owner.AnimState:Show("HEAD_HAT")
    ----------------------------------------------------------------------------------------------------------------
    ---
        if Widget.AddChild__old == nil then
            Widget.AddChild__old = Widget.AddChild
            Widget.AddChild = function(self,child)
                if type(child) == "string" then
                    print("error",child)
                    return
                end
                return Widget.AddChild__old(self,child)
            end
        end
    ----------------------------------------------------------------------------------------------------------------
    --- 数据

            -- local LANGUAGE = "ch"
            -- if type(TUNING["hutao.Language"]) == "function" then
            --     LANGUAGE = TUNING["hutao.Language"]()
            -- elseif type(TUNING["hutao.Language"]) == "string" then
            --     LANGUAGE = TUNING["hutao.Language"]
            -- end
            -- local BASE_ATLAS = "images/widgets/hutao_inspect_hud.xml"
            -- local BUFF_ICON_ATLAS = "images/widgets/hutao_talent_buff_icon.xml"
            -- TUNING.HUTAO_INSPECT_HUD_DATA = {
            --     ----------------------------------------------------------------------------------------------------------
            --     -- 页面选择-角色
            --         button_character = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "button_character_ch.tex" or "button_character_en.tex",
            --         },
            --         button_character_unselected = {
            --             atlas = BASE_ATLAS,
            --             image = "button_character_unselected.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- 页面选择-技能
            --         button_skill = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "button_skill_ch.tex" or "button_skill_en.tex",
            --         },
            --         button_skill_unselected = {
            --             atlas = BASE_ATLAS,
            --             image = "button_skill_unselected.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- 页面选择-突破
            --         button_ascension = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "button_ascension_ch.tex" or "button_ascension.tex",
            --         },
            --         button_ascension_unselected = {
            --             atlas = BASE_ATLAS,
            --             image = "button_ascension_unselected.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- page_character_level_box
            --         page_character_level_box = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "page_character_level_box_ch.tex" or "page_character_level_box_en.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- page_skill_tactic_list
            --         page_skill_tactic_list = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "page_skill_tactic_list_ch.tex" or "page_skill_tactic_list_en.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- page_ascension_button_help 
            --         page_ascension_button_help = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "page_ascension_button_help_ch.tex" or "page_ascension_button_help_en.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- page_ascension_button_ascension 
            --         page_ascension_button_ascension = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "page_ascension_button_ascension_ch.tex" or "page_ascension_button_ascension_en.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- page_ascension_ex_box_button_yes_ch 
            --         page_ascension_ex_box_button_yes = {
            --             atlas = BASE_ATLAS,
            --             image = LANGUAGE == "ch" and "page_ascension_ex_box_button_yes_ch.tex" or "page_ascension_ex_box_button_yes_en.tex",
            --         },
            --     ----------------------------------------------------------------------------------------------------------
            --     -- 所有的文本统一在这里面
            --         --[[
            --             pt 为偏移坐标
            --             str 为文本内容
            --             size 为字体大小
            --         ]]
            --         all_info = {
            --             --------------------------------------------------------------
            --             ---- 高等元素论
            --                 ["advanced_element_theory"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             高级元素理论 01
            --                             高级元素理论 02
            --                             高级元素理论 03
            --                             高级元素理论 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             advanced_element_theory 01
            --                             advanced_element_theory 02
            --                             advanced_element_theory 03
            --                             advanced_element_theory 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 神游界外
            --                 ["beyond_the_world"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             神游界外 01
            --                             神游界外 02
            --                             神游界外 03
            --                             神游界外 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             beyond_the_world 01
            --                             beyond_the_world 02
            --                             beyond_the_world 03
            --                             beyond_the_world 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 多多益善
            --                 ["the_more_the_better"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             多多益善 01
            --                             多多益善 02
            --                             多多益善 03
            --                             多多益善 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             the_more_the_better 01
            --                             the_more_the_better 02
            --                             the_more_the_better 03
            --                             the_more_the_better 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 蝶隐之时
            --                 ["time_of_butterfly_concealment"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             蝶隐之时 01
            --                             蝶隐之时 02
            --                             蝶隐之时 03
            --                             蝶隐之时 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             time_of_butterfly_concealment 01
            --                             time_of_butterfly_concealment 02
            --                             time_of_butterfly_concealment 03
            --                             time_of_butterfly_concealment 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 血之灶火
            --                 ["blood_hearth_fire"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             血之灶火 01
            --                             血之灶火 02
            --                             血之灶火 03
            --                             血之灶火 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             blood_hearth_fire 01
            --                             blood_hearth_fire 02
            --                             blood_hearth_fire 03
            --                             blood_hearth_fire 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 花瓣大鬼
            --                 ["flower_ghost"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             花瓣大鬼 01
            --                             花瓣大鬼 02
            --                             花瓣大鬼 03
            --                             花瓣大鬼 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             flower_ghost 01
            --                             flower_ghost 02
            --                             flower_ghost 03
            --                             flower_ghost 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 出招表
            --                 ["tactic_list"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             出招表 01
            --                             出招表 02
            --                             出招表 03
            --                             出招表 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             tactic_list 01
            --                             tactic_list 02
            --                             tactic_list 03
            --                             tactic_list 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 突破界面帮助按钮
            --                 ["page_ascension_button_help"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             突破界面帮助按钮 01
            --                             突破界面帮助按钮 02
            --                             突破界面帮助按钮 03
            --                             突破界面帮助按钮 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             page_ascension_button_help 01
            --                             page_ascension_button_help 02
            --                             page_ascension_button_help 03
            --                             page_ascension_button_help 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 突破界面 警告窗口
            --                 ["level_up_break_warning_info"] = {                            
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             突破界面 警告窗口 01
            --                             突破界面 警告窗口 02
            --                             突破界面 警告窗口 03
            --                             突破界面 警告窗口 04
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 35,          --- 字体大小
            --                         str = [[
            --                             level_up_break_warning_info 01
            --                             level_up_break_warning_info 02
            --                             level_up_break_warning_info 03
            --                             level_up_break_warning_info 04
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             ---- 突破信息
            --                 ["page_ascension_memorial_tablet_1"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             头七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             头七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_2"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             二七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             二七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_3"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             三七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             三七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_4"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             四七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             四七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_5"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             五七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             五七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_6"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             6七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             6七
            --                         ]]
            --                     },
            --                 },
            --                 ["page_ascension_memorial_tablet_7"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             断七
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 80,          --- 字体大小
            --                         str = [[
            --                             断七
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info 彼岸蝶舞
            --                 ["hutao_com_butterfly_s_embrace"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             彼岸蝶舞
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             彼岸蝶舞
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info buff-肉感（梅菜扣肉）
            --                 ["hutao_debuff_braised_pork_belly_with_preserved_vegetable"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-肉感（梅菜扣肉）
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-肉感（梅菜扣肉）
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info buff-通窍（幽幽大行军）
            --                 ["hutao_debuff_ghostly_march"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-通窍（幽幽大行军）
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-通窍（幽幽大行军）
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info buff-酗酒（梅花酿）
            --                 ["hutao_debuff_plum_blossom_wine"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-酗酒（梅花酿）
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-酗酒（梅花酿）
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info debuff-不朽尸王
            --                 ["hutao_debuff_undying_lich"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             debuff-不朽尸王
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             debuff-不朽尸王
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info debuff-信
            --                 ["hutao_debuff_undying_lich_after_wakeup"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             debuff-信
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             debuff-信
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --             --- buff info buff-蝶隐之时
            --                 ["hutao_debuff_vanishing_butterfly_moment"] = {
            --                     ["ch"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-蝶隐之时
            --                         ]]
            --                     },
            --                     ["en"] = {
            --                         pt = Vector3(0,0,0), -- 坐标
            --                         size = 45,          --- 字体大小
            --                         str = [[
            --                             buff-蝶隐之时
            --                         ]]
            --                     },
            --                 },
            --             --------------------------------------------------------------
            --         }
            --     ----------------------------------------------------------------------------------------------------------
            -- }
            -- local function get_image(image_name)
            --     local temp_data = TUNING.HUTAO_INSPECT_HUD_DATA[image_name]
            --     if temp_data then
            --         return temp_data.atlas,temp_data.image
            --     end
            --     print("get_image error",image_name)
            --     return nil,nil
            -- end
            -- TUNING.HUTAO_INSPECT_HUD_FNS.get_image = get_image
            -- local function get_info(index)
            --     local temp_data = TUNING.HUTAO_INSPECT_HUD_DATA.all_info[index]
            --     if temp_data and temp_data[LANGUAGE] then
            --         local data = temp_data[LANGUAGE]
            --         local pt = data.pt or Vector3(0,0,0)
            --         local size = data.size
            --         return pt,data.str,size
            --     end
            --     return nil,nil
            -- end
            -- TUNING.HUTAO_INSPECT_HUD_FNS.get_info = get_info
    ----------------------------------------------------------------------------------------------------------------
    --- 调试坐标通用API
        local debugging_target = nil
        local ctrl_down = false
        local alt_down = false
        local function move_debug_event_install(target,root)
            local front_root = root.front_root
            local debug_location = root.debug_location

            if debug_location == nil then
                debug_location = front_root:AddChild(Text(CODEFONT,40,"  ",{ 255/255 , 255/255 ,255/255 , 1}))
                debug_location:SetPosition(100,100)
                -- root.inst:ListenForEvent("move_event",function(_,pt)
                --     debug_location:SetString("      "..tostring(pt.x)..","..tostring(pt.y))
                --     print("move_event",pt)
                -- end)
                root.inst:ListenForEvent("onremove",function()
                    debug_location:Kill()
                end)
                root.debug_location = debug_location
            end

            target.OnControl_old = target.OnControl
            target.OnControl = function(self, control, down)
                -- print("key_down",control)
                if down and control == 1 then
                    debugging_target = target
                    debug_location:SetString(tostring(target.inst)..tostring(target:GetPosition()))
                    print("select target",target:GetPosition())
                end
                return self:OnControl_old(control, down)
            end
            target.inst:ListenForEvent("debug_move",function(_,pt)
                local origin_pt = target:GetPosition()
                local new_pt = Vector3(origin_pt.x + pt.x,origin_pt.y + pt.y,0)
                target:SetPosition(new_pt.x,new_pt.y)
                debug_location:SetString("      "..tostring(new_pt.x)..","..tostring(new_pt.y))
                print("debug_move",new_pt)
            end)
            if root.__input_handler == nil then
                local input_handler = TheInput:AddKeyHandler(function(key,down)
                    if key == 306 then
                        ctrl_down = down
                    end
                    if key == 308 then
                        alt_down = down
                    end
                    if key == 96 then
                        debugging_target = nil
                        -- debug_location:SetString("Console")
                        return
                    end
                    if down then
                        -- print("key_down",key)
        
                        local pt =  nil
                        if key == 274 then -- down
                            pt = Vector3(0,-10,0)
                        elseif key == 273 then -- up
                            pt = Vector3(0,10,0)
                        elseif key == 276 then -- left
                            pt = Vector3(-10,0,0)
                        elseif key == 275 then -- right                                    
                            pt = Vector3(10,0,0)
                        end
        
                        if pt then
                            if ctrl_down then
                                pt = pt * 10
                            end
                            if alt_down then
                                pt = pt:Normalize()
                            end
                            if debugging_target then
                                debugging_target.inst:PushEvent("debug_move",pt)
                            end
                        end
        
                    end
                end)
                root.__input_handler = input_handler
                root.inst:ListenForEvent("onremove",function()
                    input_handler:Remove()
                end)
            end
        end
    ----------------------------------------------------------------------------------------------------------------
    --- create_character_page
        -- TUNING.HUTAO_INSPECT_HUD_FNS.create_character_page = function(inst,root)            
        --     ----------------------------------------------------------------------
        --     --- page 节点
        --         local page = root:AddChild(Widget())
        --         page:Hide()
        --         root.inst:ListenForEvent("page_display",function(_,cmd)
        --             if cmd == "display_character_page" then
        --                 page:Show()
        --             else
        --                 page:Hide()
        --             end
        --         end)
        --     ----------------------------------------------------------------------
        --     --- level box
        --         local level_box = page:AddChild(Image(get_image("page_character_level_box")))
        --         level_box:SetPosition(-430,80)
        --         local level_box_text = level_box:AddChild(Text(CODEFONT,80,"0",{ 74/255 , 0/255 ,0/255 , 1}))
        --         level_box_text:SetPosition(30,150)
        --     ----------------------------------------------------------------------
        --     --- 文本
        --         local text_font = CODEFONT
        --         local text_size = 45
        --         local text_color = { 74/255 , 0/255 ,0/255 , 1}
        --         ------------------------------------------------------------------
        --         --- 血量上限
        --             local text_max_health = page:AddChild(Text(text_font,text_size,"血量上限",text_color))                
        --             -- move_debug_event_install(text_max_health:AddChild(Image(BASE_ATLAS,"xp.tex")),root)
        --             text_max_health:SetPosition(-490,90)
        --         ------------------------------------------------------------------
        --         --- 速度
        --             local text_speed = page:AddChild(Text(text_font,text_size,"速度",text_color))                
        --             -- move_debug_event_install(text_max_health:AddChild(Image(BASE_ATLAS,"xp.tex")),root)
        --             text_speed:SetPosition(-490,10)
        --         ------------------------------------------------------------------
        --         --- 体力系数
        --             local text_physical_power = page:AddChild(Text(text_font,text_size,"体力系数",text_color))                
        --             text_physical_power:SetPosition(-490,-70)
        --         ------------------------------------------------------------------
        --         --- 理智上限
        --             local text_max_sanity = page:AddChild(Text(text_font,text_size,"理智上限",text_color))                
        --             -- move_debug_event_install(text_max_sanity:AddChild(Image(BASE_ATLAS,"xp.tex")),root)
        --             text_max_sanity:SetPosition(-320,90)
        --         ------------------------------------------------------------------
        --         --- 攻击系数
        --             local text_damage_mult = page:AddChild(Text(text_font,text_size,"攻击系数",text_color))                
        --             text_damage_mult:SetPosition(-320,10)
        --         ------------------------------------------------------------------
        --         --- 火伤
        --             local text_fire_damage_mult = page:AddChild(Text(text_font,text_size,"火伤系数",text_color))                
        --             text_fire_damage_mult:SetPosition(-320,-70)
        --     ----------------------------------------------------------------------
        --     --- level bar
        --         local level_bar = page:AddChild(Widget())
        --         level_bar:SetPosition(-600,160)
        --         -- move_debug_event_install(level_bar,root)
        --         local level_bar_fill = level_bar:AddChild(Image(BASE_ATLAS,"exp_bar_blue.tex"))
        --         level_bar_fill:SetPosition(0,0)
        --         -- local delta = FRAMES
        --         -- level_bar.inst:DoPeriodicTask(FRAMES,function()
        --         --     -- level_bar_fill:SetScale(current,1)
        --         -- end)
        --         local level_bar_frame = level_bar:AddChild(Image(BASE_ATLAS,"exp_bar_frame.tex"))

        --         local xp_icon = page:AddChild(Image(BASE_ATLAS,"xp.tex"))
        --         xp_icon:SetPosition(-400,179)
        --         local xp_text = xp_icon:AddChild(Text(CODEFONT,25,"0000",{ 74/255 , 0/255 ,0/255 , 1}))
        --         xp_text:SetPosition(80 + 15,0)

        --         local function update_xp_text()
        --             local current_exp = inst.replica.hutao_com_level_sys:GetExp()
        --             local max_exp = inst.replica.hutao_com_level_sys:GetExpMax()
        --             local exp_precent = math.min(current_exp/max_exp,1)
        --             level_bar_fill:SetScale(exp_precent,1)
        --             xp_text:SetString(""..current_exp.." / "..max_exp)

        --             local current_level = inst.replica.hutao_com_level_sys:GetLevel()
        --             level_box_text:SetString(""..current_level)

        --             if not inst.replica.hutao_com_level_sys:IsLevelUpLocking() then
        --                 level_bar_fill:SetTexture(BASE_ATLAS,"exp_bar_blue.tex")
        --             else
        --                 level_bar_fill:SetTexture(BASE_ATLAS,"exp_bar_red.tex")
        --             end
        --         end
        --         update_xp_text()
        --         page.inst:ListenForEvent("hutao_com_level_sys_update",update_xp_text,inst)
        --     ----------------------------------------------------------------------
        --     --- page_character_buff_box
        --         local buff_box = page:AddChild(Image(BASE_ATLAS,"page_character_buff_box.tex"))
        --         buff_box:SetPosition(430,80)
        --     ----------------------------------------------------------------------
        --     --- page_character_info_box
        --         local info_box = page:AddChild(Image(BASE_ATLAS,"page_character_info_box.tex"))
        --         info_box:SetPosition(0,-280)
        --         local info_str = info_box:AddChild(Text(CODEFONT,45,"",{ 0/255 , 0/255 ,0/255 , 1}))
        --         page.inst:ListenForEvent("set_info",function(_,index)
        --             local pt,str,size = get_info(index)
        --             if pt and str and size then
        --                 info_str:SetString(str)
        --                 info_str:SetPosition(pt.x,pt.y)
        --                 info_str:SetSize(size)
        --             else
        --                 info_str:SetString("")
        --                 info_str:SetPosition(0,0)
        --                 info_str:SetSize(45)
        --             end
 
        --         end)
        --     ----------------------------------------------------------------------
        --     --- 主图标
        --         local main_icon = page:AddChild(Image(BUFF_ICON_ATLAS,"main_icon.tex"))
        --         main_icon:SetPosition(0,80)
        --     ----------------------------------------------------------------------
        --     --- buff box
        --         TUNING.HUTAO_INSPECT_HUD_FNS.buff_box_create(inst,page)
        --         -- print("77777777")
        --     ----------------------------------------------------------------------
        --     ---
        --         return page
        --     ----------------------------------------------------------------------
        -- end
    ----------------------------------------------------------------------------------------------------------------
    --- create_skill_page
        -- TUNING.HUTAO_INSPECT_HUD_FNS.create_skill_page = function(inst,root)            
        --     ----------------------------------------------------------------------
        --     --- page 节点
        --         local page = root:AddChild(Widget())
        --         page:Hide()
        --         root.inst:ListenForEvent("page_display",function(_,cmd)
        --             if cmd == "display_skill_page" then
        --                 page:Show()
        --             else
        --                 page:Hide()
        --             end
        --         end)
        --     ----------------------------------------------------------------------
        --     --- 出招表
        --         local tactic_list_box = page:AddChild(Image(get_image("page_skill_tactic_list")))
        --         tactic_list_box:SetPosition(-230,150)

        --         local tactic_list_box_str = tactic_list_box:AddChild(Text(CODEFONT,25,"",{ 0/255 , 0/255 ,0/255 , 1}))
        --         local update_tactic_list_box = function()
        --             local pt,str,size = get_info("tactic_list")
        --             if pt and str and size then
        --                 tactic_list_box_str:SetString(str)
        --                 tactic_list_box_str:SetSize(size)
        --                 tactic_list_box_str:SetPosition(pt.x,pt.y)
        --             end
        --         end
        --         update_tactic_list_box()
        --     ----------------------------------------------------------------------
        --     --- 点数box
        --         local page_skill_petals_box = page:AddChild(Image(BASE_ATLAS,"page_skill_petals_box.tex"))
        --         page_skill_petals_box:SetPosition(490,220)

        --         local petals_text = page_skill_petals_box:AddChild(Text(CODEFONT,80,"0",{ 0/255 , 0/255 ,0/255 , 1}))
        --         petals_text:SetPosition(80,0)                
        --     ----------------------------------------------------------------------
        --     --- 技能info box
        --         local page_skill_info_box = page:AddChild(Image(BASE_ATLAS,"page_skill_info_box.tex"))
        --         page_skill_info_box:SetPosition(-365,-210)
        --         -- move_debug_event_install(page_skill_info_box,root)

        --         local info_str = page_skill_info_box:AddChild(Text(CODEFONT,25,"",{ 0/255 , 0/255 ,0/255 , 1}))
        --         info_str:SetPosition(0,0)
        --         page.inst:ListenForEvent("mouse_over",function(_,talent)
        --             local pt,str,size = get_info(talent)
        --             if pt and str then
        --                 info_str:SetString(str)
        --                 info_str:SetPosition(pt.x,pt.y)
        --                 if size then
        --                     info_str:SetSize(size)
        --                 else
        --                     info_str:SetSize(25)
        --                 end
        --             end
        --         end)
        --         page.inst:ListenForEvent("mouse_out",function(_,talent)
        --             info_str:SetString("")
        --         end)
        --     ----------------------------------------------------------------------
        --     --- 梅花背景
        --         local flower_background = page:AddChild(Image(BASE_ATLAS,"page_skill_flower_background.tex"))
        --         flower_background:SetPosition(270,-70)
        --         -- move_debug_event_install(flower_background,root)
        --     ----------------------------------------------------------------------
        --     --- 花瓣
        --         local flower_ghost = flower_background:AddChild(ImageButton(BASE_ATLAS,
        --             "page_skill_flower_ghost.tex",
        --             "page_skill_flower_ghost.tex",
        --             "page_skill_flower_ghost.tex",
        --             "page_skill_flower_ghost.tex",
        --             "page_skill_flower_ghost.tex"
        --         ))
        --         flower_ghost.focus_scale = {1.02, 1.02, 1.02}
        --         -- flower_ghost:SetTint(1,1,1,0.5)
        --         flower_ghost:SetPosition(30,-46)
        --         flower_ghost.ongainfocus = function(flag)
        --             page.inst:PushEvent("mouse_over","flower_ghost")
        --         end
        --         flower_ghost.onlosefocus = function(flag)
        --             page.inst:PushEvent("mouse_out")
        --         end

        --         local flower_petals = {}

        --         flower_petals[1] = flower_background:AddChild(Image(BASE_ATLAS,"page_skill_flower_1.tex"))
        --         flower_petals[1]:SetPosition(7,147)

        --         flower_petals[2] = flower_background:AddChild(Image(BASE_ATLAS,"page_skill_flower_2.tex"))
        --         flower_petals[2]:SetPosition(180,38)

        --         flower_petals[3] = flower_background:AddChild(Image(BASE_ATLAS,"page_skill_flower_3.tex"))
        --         flower_petals[3]:SetPosition(-166,38)

        --         flower_petals[4] = flower_background:AddChild(Image(BASE_ATLAS,"page_skill_flower_4.tex"))
        --         flower_petals[4]:SetPosition(-124,-181)

        --         flower_petals[5] = flower_background:AddChild(Image(BASE_ATLAS,"page_skill_flower_5.tex"))
        --         flower_petals[5]:SetPosition(135,-183)

        --         flower_ghost:MoveToFront()
        --     ----------------------------------------------------------------------
        --     --- 按钮事件初始化 。包括 info 
        --         local function button_fns_install(temp_button)
        --             local talent = temp_button.talent
        --             temp_button:SetOnClick(function()
        --                 inst.replica.hutao_com_talent_tree:Unlock(talent)
        --             end)
        --             temp_button.ongainfocus = function(flag)
        --                 page.inst:PushEvent("mouse_over",talent)
        --             end
        --             temp_button.onlosefocus = function(flag)
        --                 page.inst:PushEvent("mouse_out",talent)
        --             end
        --         end
        --     ----------------------------------------------------------------------
        --     --- 技能图标-高等元素论 skill_button__advanced_element_theory
        --         local skill_button__advanced_element_theory = flower_background:AddChild(ImageButton(
        --             BUFF_ICON_ATLAS,
        --             "skill_button__advanced_element_theory.tex",
        --             "skill_button__advanced_element_theory.tex",
        --             "skill_button__advanced_element_theory.tex",
        --             "skill_button__advanced_element_theory.tex",
        --             "skill_button__advanced_element_theory.tex"
        --         ))
        --         skill_button__advanced_element_theory:SetPosition(7,213)
        --         -- skill_button__advanced_element_theory:SetOnClick(function()
        --         --     -- flower_1:Hide()
        --         -- end)
        --         skill_button__advanced_element_theory.talent = "advanced_element_theory"
        --         button_fns_install(skill_button__advanced_element_theory)
        --     ----------------------------------------------------------------------
        --     --- 技能图标-神游界外 skill_button__beyond_the_world
        --         local skill_button__beyond_the_world = flower_background:AddChild(ImageButton(
        --             BUFF_ICON_ATLAS,
        --             "skill_button__beyond_the_world.tex",
        --             "skill_button__beyond_the_world.tex",
        --             "skill_button__beyond_the_world.tex",
        --             "skill_button__beyond_the_world.tex",
        --             "skill_button__beyond_the_world.tex"
        --         ))
        --         skill_button__beyond_the_world:SetPosition(240,40)
        --         -- skill_button__beyond_the_world:SetOnClick(function()
        --         --     -- flower_2:Hide()
        --         -- end)
        --         skill_button__beyond_the_world.talent = "beyond_the_world"
        --         button_fns_install(skill_button__beyond_the_world)
        --     ----------------------------------------------------------------------
        --     --- 技能图标-多多益善 skill_button__the_more_the_better
        --         local skill_button__the_more_the_better = flower_background:AddChild(ImageButton(
        --             BUFF_ICON_ATLAS,
        --             "skill_button__the_more_the_better.tex",
        --             "skill_button__the_more_the_better.tex",
        --             "skill_button__the_more_the_better.tex",
        --             "skill_button__the_more_the_better.tex",
        --             "skill_button__the_more_the_better.tex"
        --         ))
        --         skill_button__the_more_the_better:SetPosition(-223,42)
        --         -- skill_button__the_more_the_better:SetOnClick(function()
        --         --     -- flower_3:Hide()
        --         -- end)
        --         skill_button__the_more_the_better.talent = "the_more_the_better"
        --         button_fns_install(skill_button__the_more_the_better)
        --     ----------------------------------------------------------------------
        --     --- 技能图标-蝶隐之时 skill_button__time_of_butterfly_concealment
        --         local skill_button__time_of_butterfly_concealment = flower_background:AddChild(ImageButton(
        --             BUFF_ICON_ATLAS,
        --             "skill_button__time_of_butterfly_concealment.tex",
        --             "skill_button__time_of_butterfly_concealment.tex",
        --             "skill_button__time_of_butterfly_concealment.tex",
        --             "skill_button__time_of_butterfly_concealment.tex",
        --             "skill_button__time_of_butterfly_concealment.tex"
        --         ))
        --         skill_button__time_of_butterfly_concealment:SetPosition(-138,-223)
        --         -- skill_button__time_of_butterfly_concealment:SetOnClick(function()
        --         --     -- flower_4:Hide()
        --         -- end)
        --         skill_button__time_of_butterfly_concealment.talent = "time_of_butterfly_concealment"
        --         button_fns_install(skill_button__time_of_butterfly_concealment)
        --     ----------------------------------------------------------------------
        --     --- 技能图标-血之灶火 skill_button__blood_hearth_fire
        --         local skill_button__blood_hearth_fire = flower_background:AddChild(ImageButton(
        --             BUFF_ICON_ATLAS,
        --             "skill_button__blood_hearth_fire.tex",
        --             "skill_button__blood_hearth_fire.tex",
        --             "skill_button__blood_hearth_fire.tex",
        --             "skill_button__blood_hearth_fire.tex",
        --             "skill_button__blood_hearth_fire.tex"
        --         ))
        --         skill_button__blood_hearth_fire:SetPosition(150,-230)
        --         -- skill_button__blood_hearth_fire:SetOnClick(function()
        --         --     -- flower_5:Hide()
        --         -- end)
        --         skill_button__blood_hearth_fire.talent = "blood_hearth_fire"
        --         button_fns_install(skill_button__blood_hearth_fire)
        --     ----------------------------------------------------------------------
        --     --- update
        --         local index_and_talent = {
        --             [1] = skill_button__advanced_element_theory,
        --             [2] = skill_button__beyond_the_world,
        --             [3] = skill_button__the_more_the_better,
        --             [4] = skill_button__time_of_butterfly_concealment,
        --             [5] = skill_button__blood_hearth_fire,
        --         }
        --         local function param_update_fn()
        --             --- 剩余天赋点数
        --             petals_text:SetString(tostring(inst.replica.hutao_com_talent_tree:GetPoints()))
        --             --- 花瓣和天赋状态
        --             local showing_num = 0
        --             for index,temp_button in pairs(index_and_talent) do
        --                 if inst.replica.hutao_com_talent_tree:IsUnlocked(temp_button.talent) then
        --                     flower_petals[index]:Show()
        --                     showing_num = showing_num + 1
        --                 else
        --                     flower_petals[index]:Hide()
        --                 end
        --             end
        --             --- 幽灵
        --             if showing_num == 5 then
        --                 flower_ghost:Show()
        --             else
        --                 flower_ghost:Hide()
        --             end    
        --         end
        --         param_update_fn()
        --         root.inst:ListenForEvent("hutao_event.talent_tree_client_side_updated",param_update_fn,inst)
        --     ----------------------------------------------------------------------
        --     --- 
        --         return page
        --     ----------------------------------------------------------------------
        -- end
    ----------------------------------------------------------------------------------------------------------------
    --- create_ascension_page        
        -- TUNING.HUTAO_INSPECT_HUD_FNS.create_ascension_page = function(inst,root)            
        --     ----------------------------------------------------------------------
        --     --- page 节点
        --         local page = root:AddChild(Widget())
        --         page:Hide()
        --         root.inst:ListenForEvent("page_display",function(_,cmd)
        --             if cmd == "display_ascension_page" then
        --                 page:Show()
        --             else
        --                 page:Hide()
        --             end
        --         end)
        --     ----------------------------------------------------------------------
        --     --- level box
        --         local level_box = page:AddChild(Image(BASE_ATLAS,"page_ascension_level_box.tex"))
        --         level_box:SetPosition(-526,242)
        --         -- move_debug_event_install(level_box,root)
        --         local level_text = level_box:AddChild(Text(CODEFONT,60,"00",{ 0/255 , 0/255 ,0/255 , 1}))
        --         level_text:SetPosition(20,0)
        --         local function level_update_fn()
        --             local current_level = inst.replica.hutao_com_level_sys:GetLevel()
        --             level_text:SetString(tostring(current_level))
        --             if inst.replica.hutao_com_level_sys:CanLevelUp() then
        --                 level_text:SetColour({0/255,0/255,0/255,1})
        --             else
        --                 level_text:SetColour({255/255,0/255,0/255,1})
        --             end
        --         end
        --         level_update_fn()
        --         page.inst:ListenForEvent("hutao_com_level_sys_update",level_update_fn,inst)
        --     ----------------------------------------------------------------------
        --     --- info box
        --         local info_box = page:AddChild(Image(BASE_ATLAS,"page_ascension_info_box.tex"))
        --         info_box:SetPosition(0,-300)
        --         -- move_debug_event_install(info_box,root)
        --         local info_text = info_box:AddChild(Text(CODEFONT,60,"",{ 0/255 , 0/255 ,0/255 , 1}))
        --         page.inst:ListenForEvent("set_info",function(_,index)                    
        --             local pt,str,size = get_info(index)
        --             if pt and str and size then
        --                 info_text:SetString(str)
        --                 info_text:SetPosition(pt.x,pt.y)
        --                 info_text:SetSize(size)
        --             else
        --                 info_text:SetString("")
        --             end
        --         end)
        --         page.inst:ListenForEvent("clear_info",function()
        --             info_text:SetString("")
        --         end)
        --     ----------------------------------------------------------------------
        --     --- help button
        --         local help_atlas,help_img = get_image("page_ascension_button_help")
        --         local help_button = page:AddChild(ImageButton(help_atlas,help_img,help_img,help_img,help_img,help_img))
        --         help_button:SetPosition(525,242)
        --         help_button.focus_scale = {1,1,1}
        --         help_button.ongainfocus = function()
        --             page.inst:PushEvent("set_info","page_ascension_button_help")
        --         end
        --         help_button.onlosefocus = function()
        --             page.inst:PushEvent("clear_info")
        --         end
        --     ----------------------------------------------------------------------
        --     --- 骨灰盒子
        --         local bone_box_data = {
        --             [1] = {Vector3(-420,0,0),"page_ascension_memorial_tablet_1.tex"},
        --             [2] = {Vector3(-285,100,0),"page_ascension_memorial_tablet_2.tex"},
        --             [3] = {Vector3(-150,0,0),"page_ascension_memorial_tablet_3.tex"},
        --             [4] = {Vector3(0,100,0),"page_ascension_memorial_tablet_4.tex"},
        --             [5] = {Vector3(150,0,0),"page_ascension_memorial_tablet_5.tex"},
        --             [6] = {Vector3(285,100,0),"page_ascension_memorial_tablet_6.tex"},
        --             [7] = {Vector3(420,0,0),"page_ascension_memorial_tablet_7.tex"},
        --         }
        --         local bone_box_root = page:AddChild(Widget())
        --         bone_box_root:SetPosition(0,15)
        --         local bone_box_buttons = {}
        --         for index, data in pairs(bone_box_data) do
        --             local temp_button = bone_box_root:AddChild(ImageButton(BASE_ATLAS,
        --                 "page_ascension_memorial_tablet_0.tex",
        --                 "page_ascension_memorial_tablet_0.tex",
        --                 "page_ascension_memorial_tablet_0.tex",
        --                 "page_ascension_memorial_tablet_0.tex",
        --                 "page_ascension_memorial_tablet_0.tex"
        --             ))
        --             temp_button:SetPosition(data[1].x,data[1].y)
        --             temp_button.focus_scale = {1.01,1.01,1.01}
        --             -- table.insert(bone_box_buttons,temp_button)
        --             bone_box_buttons[index] = temp_button
        --             -- move_debug_event_install(temp_button,root)
        --             -- temp_button:SetOnClick(function()
        --             --     print("click ",index)
        --             -- end)
        --             temp_button.ongainfocus = function()
        --                 page.inst:PushEvent("set_info","page_ascension_memorial_tablet_"..index)
        --                 temp_button:MoveToFront()
        --             end
        --             -- temp_button.onlosefocus = function()
        --             --     page.inst:PushEvent("clear_info")
        --             -- end
        --         end
        --         local function bone_box_button_update_fn()
        --             for index, v in pairs(bone_box_buttons) do
        --                 if index%2 == 0 then
        --                     bone_box_buttons[index]:MoveToBack()
        --                 else
        --                     bone_box_buttons[index]:MoveToFront()
        --                 end
        --             end
        --             -- local current_level = inst.replica.hutao_com_level_sys:GetLevel()
        --             local level_up_unlocked_data = inst.replica.hutao_com_level_sys:GetData("level_up_unlocked") or {}
        --             local offset_y = 40  --- 变成牌子的时候坐标偏移
        --             for index, lv in pairs(level_up_unlocked_data) do
        --                 if lv then
        --                     bone_box_buttons[index]:SetTextures(
        --                         BASE_ATLAS,
        --                         bone_box_data[index][2],
        --                         bone_box_data[index][2],
        --                         bone_box_data[index][2],
        --                         bone_box_data[index][2],
        --                         bone_box_data[index][2]
        --                     )
        --                     bone_box_buttons[index]:SetPosition(bone_box_data[index][1].x,bone_box_data[index][1].y+offset_y)
        --                 end
        --             end
        --             ------- 49级的时候
        --             if inst.replica.hutao_com_level_sys:GetLevel() >= 49 then
        --                 local index = 7
        --                 bone_box_buttons[index]:SetPosition(bone_box_data[index][1].x,bone_box_data[index][1].y+offset_y)
        --                 bone_box_buttons[index]:SetTextures(
        --                     BASE_ATLAS,
        --                     bone_box_data[index][2],
        --                     bone_box_data[index][2],
        --                     bone_box_data[index][2],
        --                     bone_box_data[index][2],
        --                     bone_box_data[index][2]
        --                 )
        --             end
        --             -- print("66666",inst.replica.hutao_com_level_sys:GetLevel())
        --         end
        --         bone_box_button_update_fn()
        --         page.inst:ListenForEvent("hutao_com_level_sys_update",bone_box_button_update_fn,inst)
        --     ----------------------------------------------------------------------
        --     --- 突破按钮
        --         local button_ascension_atlas ,button_ascension_img = get_image("page_ascension_button_ascension")
        --         local button_ascension = page:AddChild(ImageButton(button_ascension_atlas,
        --             button_ascension_img,
        --             button_ascension_img,
        --             button_ascension_img,
        --             button_ascension_img,
        --             button_ascension_img
        --         ))
        --         button_ascension:SetPosition(0,-128)
        --         button_ascension:SetOnClick(function()
        --             page.inst:PushEvent("level_up_break_warning_box_display")
        --         end)
        --     ----------------------------------------------------------------------
        --     --- 警告BOX
        --         local warning_box = page:AddChild(Image(BASE_ATLAS,"page_ascension_ex_box_background.tex"))
        --         warning_box:SetPosition(0,0)
        --         warning_box:Hide()
        --         --- 关闭按钮
        --         local warning_box_close_button = warning_box:AddChild(ImageButton(BASE_ATLAS,
        --             "page_ascension_ex_box_button_close.tex",
        --             "page_ascension_ex_box_button_close.tex",
        --             "page_ascension_ex_box_button_close.tex",
        --             "page_ascension_ex_box_button_close.tex",
        --             "page_ascension_ex_box_button_close.tex"
        --         ))
        --         warning_box_close_button:SetPosition(300,210)
        --         warning_box_close_button:SetOnClick(function()
        --             warning_box:Hide()
        --         end)
        --         --- 确认按钮
        --         local warning_box_yes_button_atlas,warning_box_yes_button_img = get_image("page_ascension_ex_box_button_yes")
        --         local warning_box_yes_button = warning_box:AddChild(ImageButton(warning_box_yes_button_atlas,
        --             warning_box_yes_button_img,
        --             warning_box_yes_button_img,
        --             warning_box_yes_button_img,
        --             warning_box_yes_button_img,
        --             warning_box_yes_button_img
        --         ))
        --         warning_box_yes_button:SetPosition(0,-140)
        --         warning_box_yes_button:SetOnClick(function()
        --             inst.replica.hutao_com_level_sys:LevelUpBreak()
        --             warning_box:Hide()
        --             button_ascension:SetClickable(false)
        --             button_ascension.inst:DoTaskInTime(2,function()
        --                 button_ascension:SetClickable(true)
        --             end)
        --         end)
        --         --- info
        --         local warning_box_info = warning_box:AddChild(Text(CODEFONT,60,"",{ 0/255 , 0/255 ,0/255 , 1}))
        --         --- 打开窗口
        --         page.inst:ListenForEvent("level_up_break_warning_box_display",function()
        --             local pt,str,size = get_info("level_up_break_warning_info")
        --             if pt and str and size then
        --                 warning_box_info:SetPosition(pt.x,pt.y)
        --                 warning_box_info:SetString(str)
        --                 warning_box_info:SetSize(size)
        --             end
        --             warning_box:Show()
        --         end)
        --     ----------------------------------------------------------------------
        --     ---
        --         return page
        --     ----------------------------------------------------------------------
        -- end
    ----------------------------------------------------------------------------------------------------------------
    --- 检查界面主节点
        -- TUNING.HUTAO_INSPECT_HUD_FNS.create_inspect_hud = function(inst,front_root)
        --     ----------------------------------------------------------------------
        --     --- 预检查 和 模块引入
        --         front_root = front_root or ThePlayer.HUD
        --     ----------------------------------------------------------------------
        --     --- 基础根节点
        --         local base_root = front_root:AddChild(Widget())
        --         base_root:SetHAnchor(1) -- 设置原点x坐标位置，0、1、2分别对应屏幕中、左、右
        --         base_root:SetVAnchor(2) -- 设置原点y坐标位置，0、1、2分别对应屏幕中、上、下
        --         base_root:SetScaleMode(SCALEMODE_FIXEDSCREEN_NONDYNAMIC)   --- 缩放模式
        --     ----------------------------------------------------------------------
        --     --- 根节点
        --         local scale = 0.55
        --         local root = base_root:AddChild(Widget())
        --         root:SetScale(scale,scale,scale)
        --         root:SetPosition(700,400)
        --     ----------------------------------------------------------------------
        --     --- 调试坐标 move_event_install
        --         root.front_root = front_root
        --     ----------------------------------------------------------------------
        --     --- 主背景
        --         local base_background = root:AddChild(Image(BASE_ATLAS,"base_background.tex"))
        --         base_background:SetClickable(false)
        --     ----------------------------------------------------------------------
        --     --- close button
        --         local close_button = root:AddChild(ImageButton(BASE_ATLAS,"close_button.tex","close_button.tex","close_button.tex","close_button.tex","close_button.tex"))
        --         close_button:SetPosition(820,390)
        --         close_button:SetOnClick(function()
        --             base_root:Kill()
        --         end)
        --         -- move_debug_event_install(close_button,root)
        --     ----------------------------------------------------------------------
        --     --- 3个页面
        --         local pages_fns = {
        --             TUNING.HUTAO_INSPECT_HUD_FNS.create_character_page,
        --             TUNING.HUTAO_INSPECT_HUD_FNS.create_skill_page,
        --             TUNING.HUTAO_INSPECT_HUD_FNS.create_ascension_page,
        --         }
        --         for index,fn in pairs(pages_fns) do
        --             fn(inst,root)
        --         end
        --     ----------------------------------------------------------------------
        --     --- 3个按钮。
        --         local page_button_offset = Vector3(7,0,0)
        --         local page_button_data = {}
        --         page_button_data[1] = {}
        --         page_button_data[1].pt = Vector3(800,210,0)+page_button_offset
        --         page_button_data[1].event = "display_character_page"
        --         page_button_data[1].selected = {}
        --         page_button_data[1].selected.atlas ,page_button_data[1].selected.image = get_image("button_character")
        --         page_button_data[1].unselected = {}
        --         page_button_data[1].unselected.atlas ,page_button_data[1].unselected.image = get_image("button_character_unselected")
        --         page_button_data[2] = {}
        --         page_button_data[2].pt = Vector3(800,70,0)+page_button_offset
        --         page_button_data[2].event = "display_skill_page"
        --         page_button_data[2].selected = {}
        --         page_button_data[2].selected.atlas ,page_button_data[2].selected.image = get_image("button_skill")
        --         page_button_data[2].unselected = {}
        --         page_button_data[2].unselected.atlas ,page_button_data[2].unselected.image = get_image("button_skill_unselected")
        --         page_button_data[3] = {}
        --         page_button_data[3].pt = Vector3(800,-70,0)+page_button_offset
        --         page_button_data[3].event = "display_ascension_page"
        --         page_button_data[3].selected = {}
        --         page_button_data[3].selected.atlas ,page_button_data[3].selected.image = get_image("button_ascension")
        --         page_button_data[3].unselected = {}
        --         page_button_data[3].unselected.atlas ,page_button_data[3].unselected.image = get_image("button_ascension_unselected")


        --         local page_buttons = {}
        --         for index, data in pairs(page_button_data) do
        --             local temp_button = root:AddChild(ImageButton(
        --                 data.unselected.atlas,
        --                 data.unselected.image,
        --                 data.unselected.image,
        --                 data.unselected.image,
        --                 data.unselected.image,
        --                 data.unselected.image
        --             ))
        --             temp_button:SetPosition(data.pt.x,data.pt.y)
        --             temp_button.inst:ListenForEvent("on_click",function()
        --                 -- root.inst:PushEvent(data.event) --- 切换页面
        --                 root.inst:PushEvent("page_display",data.event) --- 通过事件推送，进行界面显示/隐藏。
        --                 for index, button in pairs(page_buttons) do
        --                     if button == temp_button then
        --                         button.inst:PushEvent("selected")
        --                     else
        --                         button.inst:PushEvent("unselected")
        --                     end
        --                 end
        --             end)
        --             temp_button:SetOnClick(function()
        --                 temp_button.inst:PushEvent("on_click")
        --             end)
        --             temp_button.inst:ListenForEvent("selected",function()
        --                 temp_button:SetTextures(data.selected.atlas,data.selected.image,data.selected.image,data.selected.image,data.selected.image,data.selected.image)
        --             end)
        --             temp_button.inst:ListenForEvent("unselected",function()
        --                 temp_button:SetTextures(data.unselected.atlas,data.unselected.image,data.unselected.image,data.unselected.image,data.unselected.image,data.unselected.image)
        --             end)
        --             temp_button.focus_scale = {1.05, 1.05, 1.05}
        --             table.insert(page_buttons,temp_button)
        --             temp_button:MoveToBack()
        --         end                    
        --     ----------------------------------------------------------------------
        --     ---- 缺省显示
        --         local default_display_index = TUNING.HUTAO_INSPECT_HUD_FNS.default_display_index or 2
        --         page_buttons[default_display_index].inst:PushEvent("on_click")
        --     ----------------------------------------------------------------------
        --     --- 调试
        --         if TUNING.HUTAO_DEBUGGING_MODE then
        --             local temp_handler = TheInput:AddKeyHandler(function(key,down)
        --                 if down and key == 96 then
        --                     base_root:Kill()
        --                 end
        --             end)
        --             base_root.inst:ListenForEvent("onremove",function()
        --                 temp_handler:Remove()
        --             end)
        --         end
        --     ----------------------------------------------------------------------
        --     ---
        --         return base_root
        --     ----------------------------------------------------------------------
        -- end
    ----------------------------------------------------------------------------------------------------------------
    --- debuff box
        -- local debuffs_data = {
        --     -------------------------------------------------------------
        --     --- buff持续时间-彼岸蝶舞
        --         ["hutao_com_butterfly_s_embrace"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_com_butterfly_s_embrace.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 -- return inst.replica.hutao_com_inspect_data:Get("hutao_com_butterfly_s_embrace",0) > 0
        --                 -- return true
        --                 return inst.replica.hutao_com_butterfly_s_embrace:GetDebuffRemainTime() > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     -- local num = inst.replica.hutao_com_inspect_data:Get("hutao_com_butterfly_s_embrace",0)
        --                     local num = inst.replica.hutao_com_butterfly_s_embrace:GetDebuffRemainTime()
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 -- line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --                 line.inst:ListenForEvent("hutao_com_butterfly_s_embrace_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- buff-肉感（梅菜扣肉）
        --         ["hutao_debuff_braised_pork_belly_with_preserved_vegetable"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_braised_pork_belly_with_preserved_vegetable.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_braised_pork_belly_with_preserved_vegetable",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_braised_pork_belly_with_preserved_vegetable",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- buff-通窍（幽幽大行军）
        --         ["hutao_debuff_ghostly_march"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_ghostly_march.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_ghostly_march",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_ghostly_march",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- buff-酗酒（梅花酿）
        --         ["hutao_debuff_plum_blossom_wine"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_plum_blossom_wine.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_plum_blossom_wine",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_plum_blossom_wine",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- debuff-不朽尸王
        --         ["hutao_debuff_undying_lich"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_undying_lich.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_undying_lich",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_undying_lich",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- debuff-信
        --         ["hutao_debuff_undying_lich_after_wakeup"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_undying_lich_after_wakeup.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_undying_lich_after_wakeup",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_undying_lich_after_wakeup",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        --     --- buff-蝶隐之时
        --         ["hutao_debuff_vanishing_butterfly_moment"] = {
        --             atlas = "images/widgets/hutao_inspect_buff_icon.xml",
        --             image = "hutao_debuff_vanishing_butterfly_moment.tex",
        --             test_fn = function(inst) -- 是否显示图标。
        --                 return inst.replica.hutao_com_inspect_data:Get("hutao_debuff_vanishing_butterfly_moment",0) > 0
        --             end,
        --             create_fn = function(inst,line,root) -- 创建图标 和 更新函数
        --                 local str = line:AddChild(Text(CODEFONT,45,"    ",{ 0/255 , 0/255 ,0/255 , 1}))
        --                 str:SetPosition(120,0)
        --                 local update_fn = function()
        --                     local num = inst.replica.hutao_com_inspect_data:Get("hutao_debuff_vanishing_butterfly_moment",0)
        --                     if num > 0 then
        --                         --- 保留一位小数
        --                         str:SetString(string.format("%.1f",num))
        --                     else
        --                         root.inst:PushEvent("scroll_box_refresh")
        --                     end
        --                 end
        --                 update_fn()
        --                 line.inst:ListenForEvent("hutao_classified_inspect_data_update",update_fn,inst)
        --             end,
        --         },
        --     -------------------------------------------------------------
        -- }
        -- TUNING.HUTAO_INSPECT_HUD_FNS.buff_box_create = function(inst,front_root)
        -- --- 滚动条区域创建函数。得到区域位置，和所有slot
        --     --------------------------------------------------------------------------
        --     --- 基础
        --         local root = front_root:AddChild(Widget())
        --         local atlas = "images/widgets/hutao_custom_scroll_bar.xml"
        --         root:SetPosition(570,70)
        --     --------------------------------------------------------------------------
        --     --- 创建区域API
        --         local function create_scroll_box_and_get_slots(slots_num)
        --             --------------------------------------------------------------------------
        --             ---- 行数计算
        --                 local lines_num = slots_num or 8
        --             --------------------------------------------------------------------------
        --             --- 单行操作
        --                 local line_items_box = {}
        --                 local all_slots = {}
        --                 local function create_line()
        --                     local line = Widget()
        --                     -- local test_icon = line:AddChild(Image("images/widgets/hutao_inspect_buff_icon.xml","hutao_com_butterfly_s_embrace.tex"))
        --                     table.insert(all_slots,line)
        --                     return line
        --                 end
        --             --------------------------------------------------------------------------
        --             --- 滚动条区域创建
        --                 for i = 1, lines_num, 1 do
        --                     table.insert(line_items_box,create_line())
        --                 end
        --                 local listwidth = 500
        --                 local listheight = 350
        --                 local itemheight = 1
        --                 local itempadding = 70
        --                 local updatefn = function() end
        --                 local widgetstoupdate = nil
        --                 local scroll_bar_area = root:AddChild(ScrollableList(line_items_box,listwidth, listheight, itemheight, itempadding,updatefn,widgetstoupdate))
        --                 scroll_bar_area:SetPosition(0,0) -- 设置滚动区域位置
        --                 scroll_bar_area.scroll_bar_container:SetPosition(-260,10)  --- 设置滚动条位置
        --                 ---- 设置滚动条样式
        --                 scroll_bar_area.up_button:SetTextures(atlas,"arrow_scrollbar_up.tex")
        --                 scroll_bar_area.down_button:SetTextures(atlas,"arrow_scrollbar_down.tex")
        --                 scroll_bar_area.scroll_bar_line:SetTexture(atlas,"scrollbarline.tex")
        --                 scroll_bar_area.position_marker:SetTextures(atlas,"scrollbarbox.tex","scrollbarbox.tex","scrollbarbox.tex","scrollbarbox.tex","scrollbarbox.tex")
        --                 scroll_bar_area.position_marker:OnGainFocus() --- 不知道为什么，贴图替换失败。只能用这种方式刷一下。
        --                 scroll_bar_area.position_marker:OnLoseFocus()
        --             --------------------------------------------------------------------------

        --             --------------------------------------------------------------------------

        --             return scroll_bar_area,all_slots
        --         end
        --     --------------------------------------------------------------------------
        --     --- 生成滚动条区域
        --         -- local scroll_bar_area,all_slots = create_scroll_box_and_get_slots(0)
        --     --------------------------------------------------------------------------
        --     --- 检查当前的debuff数量,并生成滚动条区域
        --         root.inst:ListenForEvent("scroll_box_refresh",function()
        --             if root.scroll_bar_area then
        --                 root.scroll_bar_area:Kill()
        --                 root.scroll_bar_area = nil
        --             end
        --             local activing_debuffs = {}
        --             for debuff_index, data_fn in pairs(debuffs_data) do
        --                 if data_fn.test_fn(inst) then
        --                     table.insert(activing_debuffs,debuff_index)
        --                 end
        --             end
        --             if #activing_debuffs == 0 then
        --                 return
        --             end
        --             local scroll_bar_area,all_slots = create_scroll_box_and_get_slots(#activing_debuffs)
        --             for k, line in pairs(all_slots) do
        --                 local debuff_index = activing_debuffs[k]
        --                 local debuff_data = debuffs_data[debuff_index]
        --                 local icon = line:AddChild(ImageButton(debuff_data.atlas,
        --                     debuff_data.image,
        --                     debuff_data.image,
        --                     debuff_data.image,
        --                     debuff_data.image,
        --                     debuff_data.image
        --                 ))
        --                 icon.focus_scale = {1.0, 1.0, 1.0}
        --                 icon.ongainfocus = function()
        --                     front_root.inst:PushEvent("set_info",debuff_index)
        --                 end
        --                 debuff_data.create_fn(inst,line,root)
        --             end
        --             root.scroll_bar_area = scroll_bar_area
        --         end)
        --         root.inst:PushEvent("scroll_box_refresh")
        --     --------------------------------------------------------------------------
        -- end
    ----------------------------------------------------------------------------------------------------------------
    --- 测试代码

            -- ThePlayer.components.hutao_com_level_sys:ExpDoDelta(10000)
            -- ThePlayer.components.hutao_com_level_sys:LevelUpBreak()
            -- ThePlayer.components.hutao_com_level_sys:SyncData()

            -- print(ThePlayer.replica.hutao_com_level_sys:IsLevelUpLocking())

            -- for k, v in pairs(ThePlayer.replica.hutao_com_level_sys.data.level_up_locker) do
            -- -- for k, v in pairs(ThePlayer.components.hutao_com_level_sys.level_up_locker) do
            --     print(k,v)
            -- end

            -- TUNING.HUTAO_INSPECT_HUD_FNS.default_display_index = 3
            -- ThePlayer:PushEvent("hutao_event.client_side_inspect_hud_open")

            -- ThePlayer.components.hutao_com_talent_tree:AddPoint(5)

            -- TUNING.___test_root_fn = function(inst,root)
            --     inst:DoTaskInTime(0.5,function()
            --                     local other_bg = root:AddChild(ImageButton(BASE_ATLAS,
            --                         "page_character_buff_box.tex",
            --                         "page_character_buff_box.tex",
            --                         "page_character_buff_box.tex",
            --                         "page_character_buff_box.tex",
            --                         "page_character_buff_box.tex"
            --                     ))
            --                     other_bg.focus_scale = {1,1,1}
            --                     other_bg:SetPosition(0,0,0)
            --                     other_bg:SetScale(3.3,2.4,0)
            --                     -- other_bg:MoveToBack()
            --     end)
            -- end
            -- ThePlayer:PushEvent("hutao_event.inspect_hud_warning",true)
            -- ThePlayer:PushEvent("hutao_event.inspect_hud_warning",true)

    ----------------------------------------------------------------------------------------------------------------
    ---
        ThePlayer.components.hutao_com_butterfly_s_embrace:Start(50)
        -- ThePlayer:AddDebuff("hutao_debuff_braised_pork_belly_with_preserved_vegetable","hutao_debuff_braised_pork_belly_with_preserved_vegetable")
        -- ThePlayer:AddDebuff("hutao_debuff_vanishing_butterfly_moment","hutao_debuff_vanishing_butterfly_moment")
    ----------------------------------------------------------------------------------------------------------------
    --- 
        -- inst:DoTaskInTime(0,function()
        --     rawset(_G,"SendCommand",function(...)
        --         print("fake error SendCommand")
        --     end)
        -- end)
    ----------------------------------------------------------------------------------------------------------------
    print("WARNING:PCALL END   +++++++++++++++++++++++++++++++++++++++++++++++++")
end)

if flg == false then
    print("Error : ",error_code)
end

-- dofile(resolvefilepath("test_fn/test.lua"))